<template>
  <div id="AsideMenu">
    <el-row class="tac">
      <el-menu
          default-active="path"
          router
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
      >

        <el-menu-item index="/admin/index">
          <el-icon><Menu /></el-icon>
          <span>首页</span>
        </el-menu-item>

        <el-sub-menu index="1" >
          <template #title>
            <el-icon>
              <Menu/>
            </el-icon>
            <span>系统管理</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/admin/user">用户管理</el-menu-item>
            <el-menu-item index="/admin/type">类型管理</el-menu-item>
          </el-menu-item-group>
        </el-sub-menu>

        <el-sub-menu index="2">
          <template #title>
            <el-icon>
              <Menu/>
            </el-icon>
            <span>数据管理</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/admin/blog">博客管理</el-menu-item>
            <el-menu-item index="/admin/tag">标签管理</el-menu-item>
          </el-menu-item-group>
        </el-sub-menu>

        <el-sub-menu index="3">
          <template #title>
            <el-icon>
              <Menu/>
            </el-icon>
            <span>评论管理</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/admin/comment">评论管理</el-menu-item>
            <el-menu-item index="/admin/message">回复管理</el-menu-item>
          </el-menu-item-group>
        </el-sub-menu>
      </el-menu>
    </el-row>
  </div>
</template>

<script>
import request from "../utils/request";
import {Menu,Location} from '@element-plus/icons'

export default {
  name: 'AsideMenu',

  components:{
    Menu,Location
  },
  data() {
    return {
      user: {},
      path: this.$route.path
    }
  },
  methods:{
    handleOpen(){},
    handleClose(){},
  },
  created() {
    let userStr = sessionStorage.getItem("user") || "{}"
    this.user = JSON.parse(userStr)
    // // 请求服务端，确认当前登录用户的 合法信息
    // request.get("/user/" + this.user.id).then(res => {
    //   if (res.code === '0') {
    //     this.user = res.data
    //   }
    // })
  }
}
</script>

<style lang="less" scoped>
@import "../style/admin/index.less";
@import "../style/admin/AsideMenu.less";
</style>
